var load = 1;
var p=1;
$(function(){
	var did=GetQueryString("mida");
	function GetQueryString(name){
	     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
	     var r = window.location.search.substr(1).match(reg);
	     if(r!=null)return  unescape(r[2]); return null;
	}
	var you =did;
	function list_qb(p){
		var d={};
		d.token=token;
		d.page=p;
		d.id =you;
		$.ajax({
		    type:"post",
		    url:url+'/user/lookteam.html?token='+token,
		    async:false,
		    data:d,
		    dataType:'json',
		    success:function(result){
		    	var tj_user=$(".tj_user").html(result.tj_user);
		        console.log(result)
		        if(result.status === "0001"){        	
					var data=result.data;
					var html ='';
					for(var i in data){
						var username = data[i].username.replace(/^(.{3})(?:\d+)(.{0})$/,"$1******");
						var truename = data[i].truename.replace( /^(.).+(.)$/g,"$1****$2");
						console.log(truename)
						html += '<li class="myteam_item"><img src="'+data[i].icon+'" alt="" class="myteam_pic" /><p class="myteam_le">';
						html += '会员账号：'+username+'<br />姓名：'+truename+'<br />等级：'+data[i].grade_name+'<br />直推人数：'+data[i].down_count_tj+'<br />团队算力：'+data[i].down_total_cash+'';
						html += '</p></li>';
					}
					if (html == "" || data.length < 10) {
						$('.notMore').css('display',"block")
						load = 0;
					}
		        	$(".myteam_list").append(html);
		        }else{
		            isErr(result);
		            //location.href="../my.html";           
		        }
		    },
			error:function(){
				layer.msg("响应失败");
			}
		})
		
	}
	list_qb(1);
	//	下拉加载更多
	$(window).scroll(function() {
		if ($(document).scrollTop() >= $(document).height() - $(window).height() - 70) {
			if (load === 1) {
				p++;
				list_qb(p);
			}
		}
	})
})


